FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 53677
EXPOSE 44377

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY src/api/dreamwork.cassandra.test.api/dreamwork.cassandra.test.api.csproj src/api/dreamwork.cassandra.test.api/
COPY src/buildingblocks/infrastucture/Jerry.Core/Jerry.Core.csproj src/buildingblocks/infrastucture/Jerry.Core/
RUN dotnet restore src/api/dreamwork.cassandra.test.api/dreamwork.cassandra.test.api.csproj
COPY . .
WORKDIR /src/src/api/dreamwork.cassandra.test.api
RUN dotnet build dreamwork.cassandra.test.api.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish dreamwork.cassandra.test.api.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "dreamwork.cassandra.test.api.dll"]
